#include "WorkingDialog.h" char *SaMakeEscapedString(char *str);
str
str
argument with all single ticks escaped. If str
is NULL or an empty string ("\0"), SaMakeEscapedString returns NULL. The return value is malloc'd data and must be free'd with the free
function.str
argument, except if str
contains a single tick (`), it will be escaped.Escaping single ticks is desirable when inserting data into a database that contains apostrophes or single quotes. For example, the "JOE'S PIZZA" would be returned as "JOE''S PIZZA".
SaMakeEscapedString
handles the NULL in empty string conditions ad hoc by allocating a string of length 5 and setting it equal to NULL with a terminator (`\0').
SaMakeEscapedString
is useful when processing values to be used in ad hoc SQL statements, and is especially useful when retrieving values from Widgets.